<?php

use yii\widgets\LinkPager;
use yii\helpers\Html;
use yii\helpers\Url;

?>
<div style="height:5px"></div>

    <table id="dnd-example" cellspacing="0" class="table table-striped table-hover">
        <thead>
            <tr>
                <th style="width:80px;">ID</th>
                <th>用户ID</th>
                <th>发表内容</th>
                <th>地点</th>
                <th>签到时间</th>
                <th align="center">操作</th>
            </tr>
        </thead>

        <tbody>

            <?php
            $users=$dataProvider->getModels();  

            foreach($users as $user)
            {
            ?>
            <tr id="user_<?=$user->id;?>">
                <td><?= $user->id;?></td>
                <td><?= $user->userid;?></td>
                <td><?= $user->tweet;?></td>
                <td><?= $user->address;?></td>
                <td><?=date('Y-m-d H:i:s',$user->inputtime);?></td>
                <td>
                    <a href="<?php echo  Url::toRoute(['user/update', 'id' => $user->id]);?>">
                        <button type="button" class="btn btn-success">编辑</button>
                    </a>
                </td>
            </tr>
                    
            <?php }?>
        </tbody>
        </table> 

<?php 
$pages=$dataProvider->getPagination();
echo LinkPager::widget([
    'pagination' => $pages,
    ]);

?>

<?php $this->beginBlock('opt') ?>

//    
function lock(id)
{
    layer.confirm(
    '确定锁定/解锁用户？',
    {icon: 5, title:'锁定/解锁'},
    function(index){
        $.get("<?=Url::toRoute(['weixin-user/lock'])?>", {id:id},
        function(data){
			layer.msg(data.msg);
			location.reload();
		});
		layer.close(index);
    });
}
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['opt'], \yii\web\View::POS_END);?>